<?php 
session_start();
include_once($_SERVER['DOCUMENT_ROOT'].'/public/func.php');
$config=include_once($_SERVER['DOCUMENT_ROOT'].'/public/config.php');
$pass=md5($_POST['pass']);
$_POST['pass']=$pass;
$name=$_POST['name'];
$res=add($config,'users',$_POST);

 if ($res===true) {
 	$_SESSION['name']=$name;
 	// $_SESSION['pass']=$pass;
 	echo '<script>alert("注册成功");window.location.href="/admin/index.php"</script>';
 }else{
 	echo '<script>alert("注册失败");window.location.href="/public/zhuche.php"</script>';
 }
?>